package pers.cocoadel.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZhenWuWang
 */
@RestController
@RefreshScope
public class PaymentController
{
    @Value("${server.port}")
    private String serverPort;

    @Value("${config.info:null}")
    private String configInfo;

    @Value("${config.ext-info:null}")
    private String extConfigInfo;

    @GetMapping("/payment/get/{id}")
    public String getPayment(@PathVariable("id") String id)
    {
        return "serverPort:" + serverPort + " paymentId: " + id;
    }

    @GetMapping("payment/getConfig")
    public String getConfigInfo()
    {
        return "serverPort: " + serverPort + "  configInfo: "+ configInfo;
    }

    @GetMapping("/payment/getExtConfig")
    public String geExtConfigInfo()
    {
        return "serverPort: " + serverPort + "  extConfigInfo: " + extConfigInfo;
    }
}
